package shake.log;

import javax.servlet.http.HttpServletRequest;

import shake.annotation.Install;
import shake.annotation.RedirectScoped;

import com.google.inject.Inject;
import com.google.inject.Provider;

@Install(precedence = Install.BUILD_IN)
@RedirectScoped
public class IdGenerator {
	@Inject
	Provider<HttpServletRequest> request;

	@Inject
	Sequence integer;

	String value;

	public String next() {
		if (value == null)
			value = request.get().getContextPath() + ":" + integer.get();
		return value;
	}

}
